import sqlite3
import json

class Indicator():
    def __init__(self):
        try:
            self.conn = sqlite3.connect('class_manager.db')
        except:
            print("connect error")
    def search(self,classname,classcode):
        sql = "select * from class where classname='"+classname+"' and classcode='"+classcode+"'"
        sql = "select * from class"
        cursor = self.conn.cursor()
        result = cursor.execute(sql).fetchone()
        if not result:
            return None
        else:
            data =  json.loads(result[-1])
            dic = {}
            for i in range(len(data)):
                tmp = data[i].split()
                dic[tmp[0]] = tmp[1]
            return dic




